<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <h1>修改</h1>
    <input type="text" placeholder="id" v-model="pet.id">
    <input type="text" placeholder="种类" v-model="pet.type">
    <input type="text" placeholder="数量" v-model="pet.num">
    <input type="text" placeholder="品种" v-model="pet.breed">
    <input type="button" value="修改" @click="update()">
</div>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
 <script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
     <script>
         let v = new Vue({
             el:"body>div",
             data:{
                 pet:{id:"1",type:"sss",num:"ss",breed:"dd"}
             },
             methods:{
                 update(){
                     axios.post("/update",v.pet).then(function (response) {
                         alert("修改成功")
                         location.href="/list.html"
                     })
                 }
             },
             created:function () {
                 axios.get("/selectById"+location.search).then(function (response) {
                     v.pet=response.data
                 })
             }

         })
     </script>
</body>
</html>